using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TiGaHandKnife : StateMachineBehaviour
{
    public string charTag;
    public float knifeHeight;
    public float dashSpeed;
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        Character chara =  GameObject.FindGameObjectWithTag(charTag).GetComponent<Character>();
        chara.velocity_Y = Mathf.Sqrt(knifeHeight * -2f * chara.gSpeed);
        Rigidbody2D rig = GameObject.FindGameObjectWithTag(charTag).GetComponent<Rigidbody2D>();
        rig.velocity = new Vector2(rig.velocity.x * dashSpeed, chara.direction.y);
        animator.SetBool("running", false);
    }
}
